/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://github.com/mineadmin
 */
import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import MaDictSelect from "@/components/ma-dict-picker/ma-dict-select.vue";
import MaUploadImage from "@/components/ma-upload-image/index.vue";
import { concat } from "lodash-es";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    {
      label: "报警图片地址",
      prop: "alarm_pic_path",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "报警图片地址" }),
      },
      itemProps: { rules: [{ required: true, message: "请输入报警图片地址" }] },
    },
    {
      label: "报警图片名称",
      prop: "alarm_pic_name",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "报警图片名称" }),
      },
      itemProps: { rules: [{ required: true, message: "请输入报警图片名称" }] },
    },
    {
      label: "摄像头ID",
      prop: "camera_id",
      render: () => MaDictSelect,
      renderProps: { multiple: false },
      itemProps: { rules: [{ required: true, message: "请输入摄像头ID" }] },
    },
    {
      label: "摄像头地址",
      prop: "camera_url",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "摄像头地址" }),
      },
      itemProps: { rules: [{ required: true, message: "请输入摄像头地址" }] },
    },
    {
      label: "图片高度",
      prop: "image_height",
      render: () => MaUploadImage,
      renderProps: { placeholder: t("form.pleaseInput", { msg: "图片高度" }) },
      itemProps: { rules: [{ required: true, message: "请输入图片高度" }] },
      multiple: false,
    },
    {
      label: "图片宽度",
      prop: "image_width",
      render: () => MaUploadImage,
      renderProps: { placeholder: t("form.pleaseInput", { msg: "图片宽度" }) },
      itemProps: { rules: [{ required: true, message: "请输入图片宽度" }] },
      multiple: false,
    },
    {
      label: "检测结果数据",
      prop: "result_data",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "检测结果数据" }),
      },
      itemProps: { rules: [{ required: true, message: "请输入检测结果数据" }] },
    },
    {
      label: "感兴趣区域",
      prop: "roi",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "感兴趣区域" }),
      },
    },
    {
      label: "源图片地址",
      prop: "src_pic_path",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "源图片地址" }),
      },
      itemProps: { rules: [{ required: true, message: "请输入源图片地址" }] },
    },
    {
      label: "源图片名称",
      prop: "src_pic_name",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "源图片名称" }),
      },
      itemProps: { rules: [{ required: true, message: "请输入源图片名称" }] },
    },
    {
      label: "任务ID",
      prop: "task_id",
      render: () => MaDictSelect,
      renderProps: { multiple: false },
      itemProps: { rules: [{ required: true, message: "请输入任务ID" }] },
    },
    {
      label: "时间戳",
      prop: "timestamp",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "时间戳" }) },
      itemProps: { rules: [{ required: true, message: "请输入时间戳" }] },
    },
  ]);
}
